// Copyright (c)  YISH. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Diagnostics.CodeAnalysis;
using NSQL.Sharpen;
using NSQL.Statements;

namespace NSQL.Expressions
{
    [SuppressMessage("ReSharper", "IdentifierTypo")]
    public class ExistsExpression : BaseExpression, IExistsExpression
    {
        public ISubquery Subquery { get; set; }

        public ExistsExpression(ISubquery subquery)
        {
            Subquery = subquery;
        }
        public override T Accept<T>(IExpressionVisitor<T> visitor) => visitor.Visit(this);
        public override void Accept(IExpressionVisitor visitor) => visitor.Visit(this);
        public override bool IsValid => true;
        protected override IExpression DeepCopy()
        {
            return new ExistsExpression(Subquery.DeepClone())
            {
                Tag = Tag
            };
        }
    }
}